package week08;

import java.awt.List;
import java.util.ArrayList;

public class Main2 {
	public static <T extends Comparable<T>> T  max(ArrayList<T> list){
	    T max = list.get(0);
	    for(T i : list){
	        if(i.compareTo(max) > 0)
	            max = i;
	    }
	    return max ;
	}

	public static void main(String[] args) {
		ArrayList<Integer> intList=new ArrayList<Integer>();
	    ArrayList<String> strList=new ArrayList<String>();
	    intList.add(1);
	    intList.add(3);
	    intList.add(2);
	    strList.add("a");
	    strList.add("b");
	    strList.add("c");
	    String maxStr = max(strList);
	    System.out.println(maxStr);
	    Integer maxInt = max(intList);
	    System.out.println(maxInt);
}
}
